// var $parentNode = window.parent.document;

// function $childNode(name) {
//     return window.frames[name]
// }

// // tooltips
// $('.tooltip-demo').tooltip({
//     selector: "[data-toggle=tooltip]",
//     container: "body"
// });

// // 使用animation.css修改Bootstrap Modal
// $('.modal').appendTo("body");

// $("[data-toggle=popover]").popover();


//判断当前页面是否在iframe中
if (top == this) {
    var gohome = '<div class="gohome"><a class="animated bounceInUp" href="index.html?v=4.0" title="返回首页"><i class="fa fa-home"></i></a></div>';
    $('body').append(gohome);
}

//animation.css
function animationHover(element, animation) {
    element = $(element);
    element.hover(
        function () {
            element.addClass('animated ' + animation);
        },
        function () {
            //动画完成之前移除class
            window.setTimeout(function () {
                element.removeClass('animated ' + animation);
            }, 2000);
        });
}

//拖动面板
function WinMove() {
    var element = "[class*=col]";
    var handle = ".ibox-title";
    var connect = "[class*=col]";
    $(element).sortable({
            handle: handle,
            connectWith: connect,
            tolerance: 'pointer',
            forcePlaceholderSize: true,
            opacity: 0.8,
        })
        .disableSelection();
}

//保存记录
function searchContents() {

    var eventName = $("#eventName").val();
    var recordTypeId = $("#recordTypeId").val();
    var happenTime = $("#happenTime").val();
    var happenStreet = $("#happenStreet").val();
    var responseUnit = $("#responseUnit").val();
    // var principePhone = $("#principePhone").val();
    var remarkTime = $("#remarkTime").val();
    // var remarkPeople = $("#remarkPeople").val();
    // var detailAddress = $("#detailAddress").val();
    // var situation = $("#situation").val();
    // var solution = $("#solution").val();
    // var files = $("#files").val();

    var url = "/admin/eventRecordQuery/searchRecordInfo";
    var data = {
        "eventName": eventName,
        "recordTypeId": recordTypeId,
        "happenTime": happenTime,
        "happenStreet": happenStreet,
        "responseUnit": responseUnit,
        // "principePhone": principePhone,
        "remarkTime": remarkTime,
        // "remarkPeople": remarkPeople,
        // "detailAddress": detailAddress,
        // "situation": situation,
        // "solution": solution,
        // "files": files
    }


    // var data2 = [];
    // var els = document.getElementsByName("responseUnit");
    // for(var i =0; i<els.length; i++){
    //     data[i] = els[i].value;
    // }

    console.log(data);

    $.ajax({
        url:url,
        type:"POST",
        dataType: 'json',
        contentType: "application/json",
        data: JSON.stringify(data),
        success:function (data) {

            $("#all-data").html(data);
            alert("查询成功");
            window.location.href="/admin/eventRecordQuery";

        },
        error:function () {
            alert("查询失败！");
        }

    });

}

//取消
function cancels() {

    location.reload();
}

// function getTableContent(id) {
//
//     var allContents = document.getElementById(id);
//     var data = [];
//     for (let i = 0; i < 10; i++) {
//         for (let j = 0; j < 10; j++) {
//             if(!data[i]){
//                 data[i] = new Array();
//             }
//             data[i][j] = allContents.rows[i].cells[j].innerHTML;
//         }
//     }
//     return data;
// }

// function exportData(id) {
//
//     $.ajax({
//
//        url: "/admin/eventRecordQuery/exportExcel",
//        type: "POST",
//        dataType: "json",
//        contentType: "application/json",
//        data: getTableContent(id),
//        success: function (data) {
//
//            $("#all-data").html(data);
//            alert("导出成功");
//        },
//         error: function () {
//
//            alert("导出失败");
//         }
//     });
// }

function exportData() {

    window.location.href = "/admin/eventRecordQuery/exportExcel2";

}